<template>
    <div>
        <div>
            订单来源：
            <Select v-model="searchData.source_id" style="width: 180px">
                <Option v-for="item in sourceArr" :value="item.id" :key="item.id" border>{{ item.title }}</Option>
            </Select>
            订单编号：
            <Input v-model="searchData.order_sn" style="width: 180px"></Input>
            手机号：
            <Input v-model="searchData.user_mobile" style="width: 120px"></Input>
            预留手机号：
            <Input v-model="searchData.mobile" style="width: 120px"></Input>
            城市：
            <Select v-model="searchData.city_id" filterable style="width: 120px" @on-change="cityChange"
                :label-in-value="true">
                <Option :value="val.city_id" v-for="val in cityArr" :key="val.id">{{ val.city_name }}</Option>
            </Select>
            教练姓名：
            <Select v-model="searchData.coach_user_id" filterable style="width: 120px">
                <Option :value="val.id" v-for="val in coachArr1" :key="val.id">{{ val.username }}</Option>
            </Select>
            订单状态：
            <Select v-model="searchData.status" style="width: 100px">
                <Option :value="key" v-for="(val, key) in orderStatusArr" :key="key">{{ val }}</Option>
            </Select>
        </div>
        <div style="margin-top: 10px;">

            预约时间：
            <Date-picker type="daterange" placeholder="开始日期" v-model="searchData.reserve_time"></Date-picker>
            下单时间：
            <Date-picker type="daterange" placeholder="开始日期" v-model="searchData.create_time"></Date-picker>

            <Button @click="search" type="primary" style="margin-left: 10px;">搜索</Button>
            <Button @click="reset" type="success" style="margin-left: 10px;">重置</Button>
            <Button @click="add(false)" type="info" style="margin-left: 10px;">添加</Button>
        </div>

        <br>
        <Table :columns="columns" :data="list" border size="small" :row-class-name="rowClassName">
            <template slot-scope="{ row , index}" slot="userSlot">
                <div style="display: flex;flex-direction: column;align-items: flex-start;">
                    <div><span style="font-weight: bold;">姓名：</span>{{ row.username }}</div>
                    <div><span style="font-weight: bold;">手机号：</span></div>
                    <div>{{ row.user_mobile }}</div>
                    <div><span style="font-weight: bold;">预留手机号：</span></div>
                    <div>{{ row.mobile }}</div>
                    <div><span style="font-weight: bold;">陪驾次数：</span>{{ row.service_num }}</div>
                </div>
            </template>
            <template slot-scope="{ row , index}" slot="coachSlot">
                <div><span style="font-weight: bold;">姓名：</span>{{ row.partner_name }}</div>
                <div><span style="font-weight: bold;">手机号：</span>{{ row.partner_mobile }}</div>
            </template>
            <template slot-scope="{ row , index}" slot="courseSlot">
                <div v-if="row.source_id > 1 && row.status != 1" style="background-color: yellow;">
                    <div><span style="font-weight: bold;">来源：</span> {{ row.source_title }}</div>
                    <div><span style="font-weight: bold;">类型：</span>{{ row.is_trial == 1 ? '体验课程' : '正式课程' }}</div>
                </div>
                <div v-else>
                    <div><span style="font-weight: bold;">来源：</span> {{ row.source_title }}</div>
                    <div><span style="font-weight: bold;">类型：</span>{{ row.is_trial == 1 ? '体验课程' : '正式课程' }}</div>
                </div>
            </template>
            <template slot-scope="{ row , index}" slot="orderSlot">
                <div><span style="font-weight: bold;">城市：</span>{{ row.city_name }}</div>
                <div><span style="font-weight: bold;">陪驾时长：</span>{{ row.duration }}</div>
            </template>
            <template slot-scope="{ row , index}" slot="orderTimeSlot">
                <div>{{ row.reserve_date }} {{ row.reserve_start }}-{{ row.reserve_end }}</div>
            </template>
            <template slot-scope="{ row , index}" slot="menuSlot">
                <div><span style="font-weight: bold;">套餐时长:</span>{{ row.menu_total }}小时</div>
                <div><span style="font-weight: bold;">套餐剩余：</span>{{ row.residue_duration }}小时</div>
            </template>
            <template slot-scope="{ row , index}" slot="feeSlot">
                <div>
                    <span style="font-weight: bold;">金额：</span>

                </div>
                <div>
                    {{ row.partner_fee_prefix }}
                    {{ row.partner_fee }} 元
                </div>
            </template>
            <template slot-scope="{ row , index}" slot="memberSlot">
                <div>
                    <div>
                        <Button @click="add(row)" type="primary" size="small" style="margin-left: 5px;">编辑</Button>
                        <Button @click="copyText(row)" type="info" size="small" style="margin-left: 5px;">复制</Button>
                        <Button @click="detail(row)" v-if="row.status == 7 && row.menu_id == 0" type="error" size="small"
                            style="margin-left: 5px;">验券</Button>
                        <Button @click="cancel(row.id)" v-if="row.status == 1 || row.status == 2 || row.status == 3"
                            type="error" size="small" style="margin-left: 5px;">取消</Button>
                        <Button @click="info111(row)" type="info" size="small" style="margin-left: 5px;">详情</Button>
                    </div>
                    <div style="margin-top: 5px;">
                        <Button @click="designOrder(row.id)" v-if="row.status == 1" type="primary" size="small"
                            style="margin-left: 5px;">派单</Button>
                        <Button @click="designOrder(row.id)" v-if="row.status == 2 || row.status == 3" type="warning"
                            size="small" style="margin-left: 5px;">改派</Button>
                        <Button @click="uploadCode(row.id)"
                            v-if="(row.status == 3 || row.status == 8) && row.source_id != 1" type="primary" size="small"
                            style="margin-left: 5px;">上传券码</Button>
                        <Button @click="removeShow(row.id, row.remark)" v-if="row.status == 2 || row.status == 3"
                            type="error" size="small" style="margin-left: 5px;">放置大厅</Button>
                    </div>

                </div>
            </template>
        </Table>
        <Paginate :total="total" @on-change="changePage" @on-page-size-change="changeSize">
        </Paginate>

        <!-- 添加订单 -->
        <Modal title="预约订单" :width="40" v-model="showAdd" :mask-closable="false">
            <Form ref="formValidate" :model="orderInfo" :label-width="80">
                <FormItem label="订单来源">
                    <radioGroup v-model="orderInfo.source_id">
                        <Radio v-for="item in sourceArr" :label="item.id" :key="item.id" border>{{ item.title }}</Radio>
                    </radioGroup>
                </FormItem>
                <FormItem label="课程类型">
                    <radioGroup v-model="orderInfo.is_trial">
                        <Radio :label="0">正式课</Radio>
                        <Radio :label="1">体验课(体验好了买套餐)</Radio>
                    </radioGroup>
                </FormItem>
                <FormItem label="城市">
                    <Select v-model="orderInfo.city_id" filterable @on-change="cityChange" :label-in-value="true">
                        <Option :value="val.city_id" v-for="val in cityArr" :key="val.id">{{ val.city_name }}</Option>
                    </Select>
                </FormItem>
                <FormItem label="详细地址">
                    <!-- <Input v-model="orderInfo.address" type="text" @on-focus="showMapModal = true"></Input> -->
                    <Input v-model="orderInfo.address" type="text"></Input>
                </FormItem>
                <FormItem label="教练">
                    <Select v-model="orderInfo.coach_user_id" filterable>
                        <Option :value="val.id" v-for="val in coachArr1" :key="val.id">{{ val.username }}</Option>
                    </Select>
                </FormItem>
                <FormItem label="预约时间 ">
                    <Date-picker type="datetime" placeholder="开始日期" v-model="orderInfo.reserve_time" :options="options3"
                        :time-picker-options="stepOption" @on-change="dataChange"></Date-picker>
                </FormItem>
                <FormItem label="时长(小时)">
                    <radioGroup v-model="orderInfo.duration">
                        <Radio :label="2">2小时</Radio>
                        <Radio :label="3">3小时</Radio>
                    </radioGroup>
                </FormItem>
                <!-- <FormItem label="总时长(小时)" v-if="orderInfo.is_trial == 0">
                    <Input v-model="orderInfo.total" type="number"></Input>
                </FormItem> -->
                <FormItem label="姓名">
                    <Input v-model="orderInfo.username" placeholder="请输入用户姓名"></Input>
                </FormItem>
                <FormItem label="手机号" prop="mobile">
                    <Input v-model="orderInfo.mobile" placeholder="请输入用户手机号"></Input>
                </FormItem>
                <FormItem label="备注">
                    <Input v-model="orderInfo.remark" type="textarea" :rows="4"></Input>
                </FormItem>

            </Form>
            <div slot="footer">
                <Button type="primary" size="large" long @click="addSubmit">确定</Button>
            </div>
        </Modal>
        <!-- 指派教练 -->
        <Modal title="教练列表" width="50" v-model="showPartnerTable" @on-ok="submit">
            手机号：
            <Input v-model="partnerSearch.mobile" style="width: 180px"></Input>
            姓名：
            <Input v-model="partnerSearch.username" style="width: 180px"></Input>
            <Button @click="search1" type="primary" style="margin-left: 10px;">搜索</Button>
            <Button @click="reset" type="success" style="margin-left: 10px;">重置</Button>
            <br>
            <br>
            <Table :columns="partnerColumns" :data="partnerList" border size="small" :footer-hide="true">
                <template slot-scope="{ row , index}" slot="memberSlot">
                    <Button @click="confirm(row.id)" type="primary" size="small" style="margin-left: 5px;">指派</Button>
                </template>
            </Table>
            <Paginate :total="partnerTotal" @on-change="changePage1">
            </Paginate>
            <div slot="footer">
            </div>
        </Modal>
        <!-- 地图 -->
        <Modal title="地图" width="80" v-model="showMapModal">
            <searchsite @getsitemsg="getsitemsgfun" :prefix="city_name"></searchsite>
        </Modal>

        <!-- 放入大厅-->
        <Modal title="备注" width="30" v-model="showRemarkModal" @on-ok="remove">
            <Form ref="formValidate" :model="orderInfo" :label-width="90">
                <FormItem label="取消原因">
                    <Select v-model="orderInfo.reason_id" filterable>
                        <Option :value="val.id" v-for="val in reasonList" :key="val.id">{{ val.title }}</Option>
                    </Select>
                </FormItem>
                <FormItem label="备注">
                    <Input v-model="orderInfo.remark" type="textarea" :rows="4"></Input>
                </FormItem>
            </Form>
        </Modal>

        <!-- 取消备注-->
        <Modal title="取消" width="30" v-model="showCancelModal" @on-ok="cancelModal">
            <Form ref="formValidate" :model="orderInfo" :label-width="90">
                <FormItem label="取消原因">
                    <Select v-model="orderInfo.reason_id" filterable>
                        <Option :value="val.id" v-for="val in reasonList" :key="val.id">{{ val.title }}</Option>
                    </Select>
                </FormItem>
                <FormItem label="备注">
                    <Input v-model="cancelInfo.remark" type="textarea" :rows="4"></Input>
                </FormItem>
            </Form>
        </Modal>

        <!-- 上传券码-->
        <Modal title="券码" width="40" v-model="showCodeModal" @on-ok="uploadCodeOk">
            <Form ref="formValidate" :model="couponInfo" :label-width="70">
                <FormItem label="填写券码">
                    <Input v-model="couponInfo.coupon_code" type="text"></Input>
                </FormItem>
                <FormItem label="图片">
                    <MyUpload :maxNumber="1" @getImages="getImg" :defaultImags="[couponInfo.coupon_code_img]"></MyUpload>
                </FormItem>
            </Form>
        </Modal>

        <!-- 详情 -->
        <Modal title="订单详情" width="60" v-model="infoModal">
            <Row><span style="color: red;font-size: 20px;">付款码：{{ infoObj.coupon_code }}</span></Row>
            <Row><span style="color: red;font-size: 20px;">付款凭证(点击图片放大)：</span>
                <ShowImg :imgUrl="infoObj.coupon_code_img"></ShowImg>
            </Row>
            <br>
            <Table :columns="columns1" :data="list1" border stripe size="small">
                <template slot-scope="{ row , index}" slot="userSlot">
                    <div v-if="row.type == 1">{{ row.user_name }}</div>
                    <div v-if="row.type == 2 || row.type == 3">{{ row.coach_name }}</div>
                    <div v-if="row.type == 4 || row.type == 5">{{ row.admin_name }}</div>
                </template>
                <template slot-scope="{ row , index}" slot="coachSlot">
                    <div v-if="row.type == 1">用户取消</div>
                    <div v-if="row.type == 2">教练拒接</div>
                    <div v-if="row.type == 3">教练放置大厅</div>
                    <div v-if="row.type == 4">后台取消</div>
                    <div v-if="row.type == 5">后台放置大厅</div>
                </template>
            </Table>
            <Paginate :total="total1" @on-change="changePage1">
            </Paginate>
        </Modal>

        <!-- 验券 -->
        <Modal title="订单详情" width="40" v-model="showDtailModal" @on-ok="auditCode">
            <Form ref="formValidate" :model="couponInfo" :label-width="70">
                <FormItem label="券码">
                    <Input v-model="couponInfo.coupon_code" type="text" disabled></Input>
                </FormItem>
                <FormItem label="图片">
                    <ShowImg :imgUrl="couponInfo.coupon_code_img"></ShowImg>
                </FormItem>
                <FormItem label="状态">
                    <radioGroup v-model="couponInfo.status">
                        <Radio :label="1">通过</Radio>
                        <Radio :label="0">拒绝</Radio>
                    </radioGroup>
                </FormItem>
            </Form>
        </Modal>

    </div>
</template>

<script>
import Paginate from "_c/paginate";
import searchsite from '@/components/qqmap/searchsite'
import MyUpload from "_c/my-upload"
import ShowImg from '_c/show_img'
import clipboard from 'clipboard';
export default {
    name: "orderList",
    components: {
        Paginate, searchsite, MyUpload, ShowImg
    },
    data() {
        return {
            // 列表
            columns: [
                {
                    title: '订单编号',
                    align: "left",
                    key: 'order_sn',
                },
                {
                    title: '学员信息',
                    align: "left",
                    width: 150,
                    slot: 'userSlot',
                },
                {
                    title: '教练信息',
                    align: "left",
                    slot: 'coachSlot',
                },
                {
                    title: '课程信息',
                    align: "left",
                    slot: 'courseSlot',
                },
                {
                    title: '订单信息',
                    align: "left",
                    slot: 'orderSlot',
                },
                {
                    title: '金额信息',
                    align: "left",
                    slot: 'menuSlot',
                },
                {
                    title: '起止时间',
                    align: "left",
                    slot: 'orderTimeSlot',
                },
                {
                    title: '订单状态',
                    align: "left",
                    width: 100,
                    key: 'order_status_txt',
                },
                {
                    title: '课时费',
                    align: "left",
                    slot: 'feeSlot',
                },
                {
                    title: '下单时间',
                    align: "left",
                    key: 'create_time',
                },
                {
                    title: '用户备注',
                    align: "left",
                    key: 'remark',
                },
                {
                    title: '操作',
                    align: "left",
                    key: 'make',
                    width: 240,
                    slot: 'memberSlot',
                },
            ],
            list: [],
            total: 0,
            searchData: {
                page: 1,
                limit: 10,
                order_type: 1
            },
            // 添加订单
            showAdd: false,
            // 指派教练
            orderInfo: {},
            coachArr: [],
            sourceArr: [],
            cityArr: [],
            coachArr1: [],
            orderStatusArr: [],
            showMapModal: false,
            mapInfo: {},
            // 教练列表
            showPartnerTable: false,
            partnerSearch: {},
            partnerTotal: 0,
            partnerList: [],
            partnerColumns: [
                {
                    title: '姓名',
                    align: "center",
                    key: 'username',
                },
                {
                    title: '手机号',
                    align: "center",
                    key: 'mobile',
                },
                {
                    title: '距离',
                    align: "center",
                    key: 'distance',
                },
                {
                    title: '操作',
                    align: "left",
                    key: 'make',
                    width: 240,
                    slot: 'memberSlot',
                },
            ],
            // 备注框
            showRemarkModal: false,
            showDtailModal: false,
            orderDetaile: {},
            // 上传券码
            showCodeModal: false,
            couponInfo: {},
            // 取消
            showCancelModal: false,
            cancelInfo: {},
            reasonList: [],
            // 地图
            city_name: '',
            // 记录
            infoModal: false,
            infoObj: {},
            columns1: [
                {
                    title: '订单编号',
                    align: "left",
                    key: 'order_sn',
                },
                {
                    title: '名称',
                    align: "left",
                    slot: 'userSlot',
                },
                {
                    title: '操作',
                    align: "left",
                    slot: 'coachSlot',
                },
                {
                    title: '备注',
                    align: "left",
                    key: 'reason',
                },
                {
                    title: '时间',
                    align: "left",
                    key: 'create_time',
                },
            ],
            list1: [],
            total1: 0,
            searchData1: {
                page: 1,
                limit: 10,
            },
            options3: {
                disabledDate(date) {
                    return date && date.valueOf() < Date.now() - 86400000;
                }
            },
            stepOption: {
                steps: [1, 30, 30],
                "hide-disabled-options": true,
                "disabled-hours": []
            },
        }
    },
    methods: {
        getImg(items) {
            items.forEach(item => {
                this.couponInfo.coupon_code_img = item.url;
            });
        },
        rowClassName(row, index) {
            // 获取目标时间和当前时间
            const targetDate = new Date(row.create_time);
            const now = new Date();

            // 计算时间差（毫秒）
            const diffMs = targetDate - now;

            // 转换为分钟并四舍五入
            const diffMinutes = Math.round(diffMs / (1000 * 60));
            if (row.status === 1 && diffMinutes > 15) {
                return 'demo-table-error-row';
            }
            return '';
        },
        getList() {
            this.$axios('/admin/partner/reserve/getList', this.searchData).then(res => {
                this.list = res.data;
                this.total = res.total;
            });
        },
        search() {
            this.searchData.page = 1;
            this.getList();
        },
        search1() {
            this.partnerSearch.page = 1;
            this.getPartenrList();
        },
        reset() {
            this.searchData = {
                page: 1,
                limit: 10,
                order_type: 1
            }
            this.getList();
        },
        reset1() {
            this.partnerSearch.username = '';
            this.partnerSearch.mobile = '';
            this.partnerSearch.page = 1;
            this.getList();
        },
        changePage(page) {
            this.searchData.page = page;
            this.getList();
        },
        changePage1(page) {
            this.partnerSearch.page = page;
            this.getPartenrList();
        },
        changePage2(page) {
            this.searchData1.page = page;
            this.getorderLogList();
        },
        changeSize(size) {
            this.searchData.limit = size;
            this.getList();
        },
        customSort(column, key, order) {
            this.searchData.order_by = column.key;
            this.searchData.sort = column.order;
            this.getList();
        },
        add(row) {
            if (row) {
                this.orderInfo = { ...row };
                this.orderInfo.reserve_time = this.orderInfo.reserve_time_txt;
                // this.orderInfo.reserve_time = this.orderInfo.reserve_start;
            } else {
                this.orderInfo = {
                    condition: 1,
                    cart_type: 1,
                    is_trial: 1,
                    duration: 2,
                    source_id: this.sourceArr.length == 0 ? 0 : this.sourceArr[0]['id'],
                };
            }
            // 获取当前时间之前的时间
            this.disabledHours = this.getPreviousHours();
            this.getCityCoachArr(row.city_id);
            this.showAdd = true;

        },
        dataChange(value) {
            // console.log(value);
            this.stepOption['disabled-hours'] = this.getPreviousHours(value);
        },
        getPreviousHours(date) {
            const timestamp = Date.parse(date);
            const todayStart = new Date();
            todayStart.setHours(0, 0, 0, 0);
            const todayStartTimestamp = todayStart.getTime();

            const hoursArray = [];
            if (timestamp == todayStartTimestamp) {
                const now = new Date();
                const currentHour = now.getHours();
                // console.log(currentHour);
                for (let i = 0; i <= currentHour; i++) {
                    hoursArray.push(i);
                }
                // console.log(hoursArray);
                return hoursArray;
            }

        },
        detail(row) {
            this.couponInfo.id = row.id
            this.couponInfo.coupon_code = row.coupon_code
            this.couponInfo.coupon_code_img = row.coupon_code_img
            this.couponInfo.status = 1;
            this.showDtailModal = true;
        },
        designOrder(id) {
            this.partnerSearch = {
                id: id,
                page: 1,
                limit: 10
            };
            this.getPartenrList();
            this.showPartnerTable = true;
        },
        submit() {
            this.$axios('/admin/partner/reserve/setCoach', this.orderInfo).then(res => {
                this.$Message.success('执行成功');
                this.getList();
            });
        },
        timeStampToDate(timestamp) {
            let date = new Date(timestamp * 1000);

            let year = date.getFullYear();
            let month = date.getMonth() + 1;
            let day = date.getDate();
            let hour = date.getHours(); // 获取小时
            let minute = date.getMinutes(); // 获取分钟
            let second = date.getSeconds(); // 获取秒

            return `${year}-${month}-${day} ${hour}:${minute}`;
        },
        // 教练列表
        getCoachArr() {
            this.$axios('/admin/partner/getArr', { type: 0 }).then(res => {
                this.coachArr = res;
            });
        },
        // 订单来源
        orderSourceArr() {
            this.$axios('/admin/config/order_source/getArr').then(res => {
                this.sourceArr = res;
            });
        },
        // 开通城市
        openCityArr() {
            this.$axios('/admin/partner/city/getArr').then(res => {
                this.cityArr = res;
            });
        },
        // 订单状态
        getOrderStatusArr() {
            this.$axios('/admin/partner/reserve/getArr').then(res => {
                this.orderStatusArr = res;
            });
        },
        addSubmit() {
            this.$axios('/admin/partner/reserve/save', this.orderInfo).then(res => {
                this.$Message.success('执行成功');
                this.showAdd = false;
                this.getList();
            });

        },
        removeShow(id, remark) {
            this.orderInfo = {
                id: id,
                remark: remark
            };
            console.log(this.orderInfo);
            this.showRemarkModal = true;
            this.getReasonList(3);
        },
        // 放入大厅
        remove() {
            this.$axios('/admin/partner/reserve/toPublic', this.orderInfo).then(res => {
                this.$Message.success('操作成功');
                this.getList();
            });
        },
        cancel(id) {
            this.cancelInfo.id = id;
            this.showCancelModal = true;
            this.getReasonList(4);
        },
        cancelModal() {
            this.$axios('/admin/partner/reserve/cancel', this.cancelInfo).then(res => {
                this.$Message.success('操作成功');
                this.getList();
            })
        },
        checkCoupon(row) {
            let code = `<span style='color:red;font-size:20px;'> ${row.coupon_code} </span>`;
            this.$Modal.confirm({
                title: '完成',
                content: "<p>券码是：" + code + "，您确定要完成该订单吗？</p>",
                onOk: () => {
                    this.$axios('/admin/partner/reserve/checkCoupon', { id: row.id }).then(res => {
                        this.$Message.success('操作成功');
                        this.getList();
                    })
                },
                onCancel: () => {
                    this.$Message.info('取消操作');
                }
            });
        },
        getsitemsgfun(item) {
            this.orderInfo.address = item.city + item.district + item.title;
            this.orderInfo.lng = item.location.lng;
            this.orderInfo.lat = item.location.lat;
            // this.showMapModal = false;
        },
        getPartenrList() {
            this.$axios('/admin/partner/reserve/getNearPartnerList', this.partnerSearch).then(res => {
                this.partnerList = res.data;
                this.partnerTotal = res.total;
            });
        },
        confirm(partnerId) {
            let param = {
                id: this.partnerSearch.id,
                coach_id: partnerId
            };
            this.$axios('/admin/partner/reserve/setCoach', param).then(res => {
                this.$Message.success('执行成功');
                this.showPartnerTable = false;
                this.getList();
            });
        },
        // 上传券码
        uploadCode(id) {
            this.couponInfo.order_id = id;
            this.couponInfo.coupon_code = '';
            this.couponInfo.coupon_code_img = '';
            this.showCodeModal = true;
        },
        uploadCodeOk() {
            if (!this.couponInfo.coupon_code) {
                this.$Message.error('请填写券码');
                return;
            }
            this.$axios('/admin/partner/reserve/uploadVoucher', this.couponInfo).then(res => {
                this.$Message.success('执行成功');
                this.showCodeModal = false;
                this.getList();
            });
        },
        getReasonList(type) {
            this.$axios('/admin/partner/reserve/getReasonList', { type: type }).then(res => {
                this.reasonList = res;
            });
        },
        cityChange(value) {
            if (value) {
                this.city_name = value.label;
                this.getCityCoachArr(value.value);
            }

        },
        getCityCoachArr(city_id) {
            this.$axios('/admin/partner/getArr', { city_id: city_id, type: 0 }).then(res => {
                this.coachArr1 = res;
            });
        },
        copyText(orderDetaile) {
            let text =
                `订单来源：${orderDetaile.source_title}
课程类型：${orderDetaile.is_trial == 1 ? '体验课程' : '正式课程'}
详细地址：${orderDetaile.address}
预约时间：${orderDetaile.reserve_time_txt}
预约时长: ${orderDetaile.duration}小时
备注：${orderDetaile.remark}`;
            clipboard.copy(text);
            this.$Message.success('复制成功');
        },
        auditCode() {
            this.$axios('/admin/partner/reserve/checkCoupon', this.couponInfo).then(res => {
                this.$Message.success('操作成功');
                this.getList();
            })
        },
        info111(row) {
            this.infoObj.coupon_code = row.coupon_code;
            this.infoObj.coupon_code_img = row.coupon_code_img;
            this.searchData1.order_id = row.id;
            this.getorderLogList();
            this.infoModal = true;
        },
        getorderLogList() {
            this.$axios('/admin/partner/reserve_log/getList', this.searchData1).then(res => {
                this.list1 = res.data;
                this.total1 = res.total;
            })
        },

    },
    created() {
        // 查询自己管理员
        this.getList();
        // this.getCoachArr();
        this.orderSourceArr();
        this.openCityArr();
        this.getOrderStatusArr();
        window.onkeydown = (res) => {
            if (res.key == 'Enter') {
                this.getList();
            }
        }
    },
    beforeDestroy() {
        window.onkeydown = ''
    }
}
</script>
<style>
.ivu-table .demo-table-error-row td {
    background-color: #ff6600;
    color: #fff;
}
</style>